/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package picstore.web.camera;

/**
 *
 * @author Daniel
 */
public class CameraRN {
    
    private CameraDAO cameraDAO;
    
    public CameraRN(){
        this.cameraDAO = DAOFactory.criarCameraDAO();
    }
    
    public Camera carregar (Integer codigo){
         return this.usuarioDAO.carregar(codigo);
     }
     
      public Camera buscarPorNome (String nome){
         return this.cameraDAO.buscarPorNome(nome);
     }
      
       public void salvar (Camera camera){
         Integer id = camera.getId();
         if (id == null || id == 0){
             this.cameraDAO.salvar(camera);
         } else {
             this.cameraDAO.atualizar(camera);
         }
         
       }
         
        public void excluir (Camera camera){
            this.cameraDAO.excluir(camera);
        }
        
        public List<Camera> listar(){
        
            return this.cameraDAO.listar();
        }
    
}
